package br.usp.pcs.basys2.event;

import java.util.Calendar;

import br.usp.pcs.basys2.BasysProcess;
import br.usp.pcs.basys2.engine.Engine;

public class EndAcessEvent extends Event {

	private String peripheralName;

	public EndAcessEvent(BasysProcess process, Calendar dateOfArrival,
			String peripheralName) {
		super(process, dateOfArrival);
		this.peripheralName = peripheralName;
	}

	@Override
	public void execute() {
		Engine engine = Engine.getInstance();
		engine.getSystem().getPeripheralManager().get(peripheralName)
				.endAccess();
		engine.getSystem().getProcessorManager().requestProcess(getProcess());
	}

}
